import { UI_Config, UI_Cache_Type } from "../../engine/UI_Config";




export class ViewConfig {

    constructor() {
    }

    public static viewConfig = {

        ViewTip: new UI_Config("view/ViewTip", UI_Cache_Type.always, false),
        ViewLoading: new UI_Config("view/ViewLoading", UI_Cache_Type.noCache, true),
        ViewAccount: new UI_Config("view/ViewAccount", UI_Cache_Type.noCache, true),
        ViewRegister: new UI_Config("view/ViewRegister", UI_Cache_Type.noCache, true),
        // ViewLogin: new UI_Config("view/ViewLogin", UI_Cache_Type.noCache, true),
        // ViewRegister: new UI_Config("view/ViewRegister", UI_Cache_Type.noCache, true),
        // ViewCheck: new UI_Config("view/ViewCheck", UI_Cache_Type.always, true),
        ViewHall: new UI_Config("view/ViewHall", UI_Cache_Type.always, true),
        // ViewSetting: new UI_Config("view/ViewSetting", UI_Cache_Type.always, true),
        // ViewCreateRoom: new UI_Config("view/ViewCreateRoom", UI_Cache_Type.always, true),


    }

    public static getMustLoadList(): Array<string> {
        let urlList: Array<string> = [
            ViewConfig.viewConfig.ViewTip.path,
            ViewConfig.viewConfig.ViewAccount.path,
            // ViewConfig.viewConfig.ViewCheck.path,
            // ViewConfig.viewConfig.ViewLogin.path,
        ];
        return urlList;
    }

    public static getPreLoadList() {
        let urlList: Array<string> = [];
        for (const key in this.viewConfig) {
            if (this.viewConfig.hasOwnProperty(key)) {
                let uiConfig: UI_Config = this.viewConfig[key];
                if (uiConfig.cacheType == UI_Cache_Type.always) {
                    urlList.push(uiConfig.path)
                }
            }
        }
        return urlList;
    }
}




